#!/bin/bash
SVNSERVER=$1
PROJECT=$2
FOLDER=$3
VERSION=$4
OPERATOR=$5
echo build normal maven bxn project
echo server:$SVNSERVER project:$PROJECT
echo folder:$FOLDER version:$VERSION
CURRENTTIME=$6
TODAY=$(date +%Y%m%d)
echo timestamp:$CURRENTTIME 
BASE=/tmp/package/$PROJECT-$CURRENTTIME
echo base:$BASE
rm -rf $BASE
export LC_CTYPE=en_US.UTF-8
svn export svn://$SVNSERVER/$PROJECT/$FOLDER/$VERSION $BASE  --username tiger --password svn555666
rm -rf /usr/jdev_app/repo/cn/boxiao
cd $BASE
cp /usr/svntools/groovyscript/build.groovy $BASE/build.groovy
groovy build.groovy $PROJECT/$FOLDER/$VERSION

mkdir dist
WAR=$(ls $BASE/temp/target/ | grep .war)
echo war name:$WAR
cp $BASE/temp/target/$WAR dist/$WAR
mkdir dist/install
cp -rf doc dist/install/doc
cp -rf script dist/install/script
cd dist
zip -r $PROJECT-$VERSION.zip *
mkdir /opt/build/$TODAY
cp $PROJECT-$VERSION.zip /opt/build/$TODAY/$PROJECT-$VERSION-$CURRENTTIME-$OPERATOR.zip
cd ../..
rm -rf $BASE

